package org.tnaggs.project.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.tnaggs.project.manager.ContactManager;
import org.tnaggs.project.manager.LocationManager;
import org.tnaggs.project.model.Location;



@Controller
@RequestMapping("/location")
public class LocationController {

	@Autowired
	private ContactManager conManager;

	@Autowired  
	private LocationManager locManager;
	
	@RequestMapping(value = "/addLocation.html", method = RequestMethod.POST)
	public String addLocation(@ModelAttribute("location")
    Location location, BindingResult result) {
		
		locManager.createLocation(location);
		
		return "redirect:/index.html";
	}
}
